<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
{echo:JS::import('dialog?skin=tinysimple');}
{echo:JS::import('dialogtools');}
<div class="container clearfix">
	{widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
	<div class="uc-content clearfix">
			<h1 class="title"><span>店铺商品：</span></h1>
			<div class="box p15 mt10 clearfix">
				<!-- <table>
					<tr>
						<td class="tab_box1">商品数量：{echo:Zyk_tj::count("goods","user_id=$user[id]")}</td>
						<td class="tab_box3">在售数量：{echo:Zyk_tj::count("goods","user_id=$user[id] and is_online=0")}</td>
						<td class="tab_box4">下架数量：{echo:Zyk_tj::count("goods","user_id=$user[id] and is_online=1")}</td>
					</tr>
				</table> -->
			商品总数：<span class="red">{echo:Zyk_tj::count("goods","u_dp_id=$user[id]")}</span>&nbsp;&nbsp;&nbsp;&nbsp;
			待审：<span class="red">{echo:Zyk_tj::count("goods","u_dp_id=$user[id] and is_online=2")}</span>&nbsp;&nbsp;&nbsp;
			在售：<span class="red">{echo:Zyk_tj::count("goods","u_dp_id=$user[id] and is_online=0")}</span>&nbsp;&nbsp;&nbsp;
			下架：<span class="red">{echo:Zyk_tj::count("goods","u_dp_id=$user[id] and is_online=1")}</span>
			<span class="fr"><a href="{url:/ucenter/goods_edit}" class="btn btn-info ">添加商品</a></span></div>
	{query:name=goods_category /}
    {set:$category_name=array();$category="";}
    {list:}
        {set:$category_name[$item['id']]=$item['name']}
        {set:$category.=$item['id'].':'."'".$item['name']."',"}
    {/list}
    {set:$category=trim($category,',');}
			<div class="tab">
				<ul class="tab-head">
					<li>全部商品<i></i></li>
					<li>待审<i></i></li>
					<li>在售<i></i></li>
					<li>下架<i></i></li>
				</ul>
				<div class="tab-body"  style="padding: 20px 10px;">
					<div class="mt5">
					<table class="simple">
						<tr>
							<th>商品名称</th> <th width="120">编号</th><th>分类</th><th width="40">售价</th><th>积分</th><th >库存</th><th >销量</th><th >状态</th><th width="70px">操作</th>
						</tr>
						{query:name=goods where=u_dp_id eq $user[id] order=id desc page=1 id=$obj}
						<tr {if:$key%2==1}class="even"{/if}>
							<td><a href="{url:/index/product/id/$item[id]}" target="_blank">{echo:TString::msubstr($item['name'],0,24)}</a></td><td>{$item['goods_no']}</td><td>{$category_name[$item['category_id']]}</td><td>{$item['sell_price']}</td>
							<td>{$item['point']}</td>
							<td {if:$item['store_nums']<=$item['warning_line']}class="red"{/if}>{$item['store_nums']}</td>
							<td>{echo:Common::getGoodNumByGId($item['id'])|0}</td><td>{if:$item['is_online']==0}<b class="green">在售</b>{elseif:$item['is_online']==1}<b class="red">下架</b>{else:}<b class="hs">待审</b>{/if}</td>
						<td class="btn_min">
							{if:$item['is_online']==1}
							<a href="{url:/ucenter/set_online/status/0/id/$item[id]}">上</a>
							{elseif:$item['is_online']==0}
                			<a href="{url:/ucenter/set_online/status/1/id/$item[id]}">下</a>
                			{/if}
                			<a href="{url:/ucenter/goods_edit/id/$item[id]}">&nbsp;&nbsp;编</a>
                			<a href="javascript:;" onclick="confirm_action('{url:/ucenter/goods_del/id/$item[id]/c/$item[user_id]}')">&nbsp;&nbsp;删</a>
               			</td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$obj->pagebar()}</div>
					</div>
					<!-- 待审 -->
					<div class="mt5">
					<table class="simple">
						<tr>
							<th>商品名称</th> <th width="120">编号</th><th>分类</th><th width="40">售价</th><th>积分</th><th >库存</th><th >销量</th><th >状态</th><th width="70px">操作</th>
						</tr>
						{query:name=goods where=u_dp_id eq $user[id] and is_online eq 2 order=id desc page=1 id=$objs}
						<tr {if:$key%2==1}class="even"{/if}>
							<td><a href="{url:/index/product/id/$item[id]}" target="_blank">{echo:TString::msubstr($item['name'],0,24)}</a></td><td>{$item['goods_no']}</td><td>{$category_name[$item['category_id']]}</td><td>{$item['sell_price']}</td><td>{$item['point']}</td><td {if:$item['store_nums']<=$item['warning_line']}class="red"{/if}>{$item['store_nums']}</td><td>{echo:Common::getGoodNumByGId($item['id'])|0}</td><td>等待审核</td>
						<td class="btn_min">
                			<a href="{url:/ucenter/goods_edit/id/$item[id]}">&nbsp;&nbsp;编</a>
                			<a href="javascript:;" onclick="confirm_action('{url:/ucenter/goods_del/id/$item[id]/c/$item[user_id]}')">&nbsp;&nbsp;删</a>
               			</td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$objs->pagebar()}</div>
					</div>
					<!-- 在售 -->
					<div class="mt5">
					<table class="simple">
						<tr>
							<th>商品名称</th> <th width="120">编号</th><th>分类</th><th width="40">售价</th><th>积分</th><th >库存</th><th >销量</th><th >状态</th><th width="70px">操作</th>
						</tr>
						{query:name=goods where=u_dp_id eq $user[id] and is_online eq 0 order=id desc page=1 id=$objs}
						<tr {if:$key%2==1}class="even"{/if}>
							<td><a href="{url:/index/product/id/$item[id]}" target="_blank">{echo:TString::msubstr($item['name'],0,24)}</a></td><td>{$item['goods_no']}</td><td>{$category_name[$item['category_id']]}</td><td>{$item['sell_price']}</td><td>{$item['point']}</td><td {if:$item['store_nums']<=$item['warning_line']}class="red"{/if}>{$item['store_nums']}</td><td>{echo:Common::getGoodNumByGId($item['id'])|0}</td><td>{if:$item['is_online']==0}<b class="green">在售</b>{else:}<b class="red">下架</b>{/if}</td>
						<td class="btn_min">
							{if:$item['is_online']==1}
							<a href="{url:/ucenter/set_online/status/0/id/$item[id]}">上</a>
							{else:}
                			<a href="{url:/ucenter/set_online/status/1/id/$item[id]}">下</a>
                			{/if}
                			<a href="{url:/ucenter/goods_edit/id/$item[id]}">&nbsp;&nbsp;编</a>
                			<a href="javascript:;" onclick="confirm_action('{url:/ucenter/goods_del/id/$item[id]/c/$item[user_id]}')">&nbsp;&nbsp;删</a>
               			</td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$objs->pagebar()}</div>
					</div>
					<!-- 下架 -->
					<div class="mt5">
					<table class="simple">
						<tr>
							<th>商品名称</th> <th width="120">编号</th><th>分类</th><th width="40">售价</th><th>积分</th><th >库存</th><th >销量</th><th >状态</th><th width="70px">操作</th>
						</tr>
						{query:name=goods where=u_dp_id eq $user[id] and is_online eq 1 order=id desc page=1 id=$objx}
						<tr {if:$key%2==1}class="even"{/if}>
							<td><a href="{url:/index/product/id/$item[id]}" target="_blank">{echo:TString::msubstr($item['name'],0,24)}</a></td><td>{$item['goods_no']}</td><td>{$category_name[$item['category_id']]}</td><td>{$item['sell_price']}</td><td>{$item['point']}</td><td {if:$item['store_nums']<=$item['warning_line']}class="red"{/if}>{$item['store_nums']}</td><td>{echo:Common::getGoodNumByGId($item['id'])|0}</td><td>{if:$item['is_online']==0}<b class="green">在售</b>{else:}<b class="red">下架</b>{/if}</td>
						<td class="btn_min">
							{if:$item['is_online']==1}
							<a href="{url:/ucenter/set_online/status/0/id/$item[id]}">上</a>
							{else:}
                			<a href="{url:/ucenter/set_online/status/1/id/$item[id]}">下</a>
                			{/if}
                			<a href="{url:/ucenter/goods_edit/id/$item[id]}">&nbsp;&nbsp;编</a>
                			<a href="javascript:;" onclick="confirm_action('{url:/ucenter/goods_del/id/$item[id]/c/$item[user_id]}')">&nbsp;&nbsp;删</a>
               			</td>
						</tr>
						{/query}
					</table>
					<div class="page-nav">{echo:$objx->pagebar()}</div>
					</div>
				</div>
		</div>
	</div>
</div>

